﻿#region Usings

using System.Data.Entity.ModelConfiguration;
using Rail.Net.Core.Model;

#endregion

namespace Rail.Net.Data.Configuration
{
    public class ReservableTrainNumberMap : EntityTypeConfiguration<ReservableTrainNumber>
    {
        public ReservableTrainNumberMap()
        {
            ToTable("ReservableTrainNumbers");
            HasKey(reservableTrainNumber => reservableTrainNumber.Id);

            Property(reservableTrainNumber => reservableTrainNumber.TrainNumber).IsRequired().HasMaxLength(10);
            Property(reservableTrainNumber => reservableTrainNumber.Include).IsRequired();
            Property(reservableTrainNumber => reservableTrainNumber.Domestic).IsRequired();
            Property(reservableTrainNumber => reservableTrainNumber.International).IsRequired();
            Property(reservableTrainNumber => reservableTrainNumber.ValidFrom).IsOptional();
            Property(reservableTrainNumber => reservableTrainNumber.ValidTo).IsOptional();
        }
    }
}